#include "sc_object.h"
#include "sc_math.h"
BEGIN_K3D


SMesh::SMesh( SStaticMesh* sta)
{
	subMesh=NULL;
	staticmesh=sta;
	transPoints.assign(staticmesh->points.begin(),staticmesh->points.end());
	sta->mat=SMatMng::getMat(sta->matname.c_str());
	if(sta->subMesh)
		subMesh=new SMesh(sta->subMesh);
}

void SMesh::transform( const Matrix& mat )
{
	for (int i=0;i<transPoints.size();i++)
	{
		VectorTransform(&transPoints[i].pos,&staticmesh->points[i].pos,&mat);
	}
	if(subMesh)subMesh->transform(mat);
}

END_K3D